/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ages.test.swat

import javax.media.opengl.GL
import com.ages.entity.Actor
import com.ages.graphics.ViewportSwitcher
import com.ages.env.Options

class BlackFade extends Actor{

  var alpha:Double = 1.0
  depth = DepthPlaces.FADE

  def think{
//    println(alpha)
    alpha-=0.01
    if(alpha<=0)
      {
        markForDeletion = true
      }
  }

  def draw(gl:GL)
  {
    ViewportSwitcher.setup2DView(gl)
    gl.glDisable(GL.GL_LIGHTING)
    gl.glColor4d(0,0,0,alpha)
    gl.glDisable(GL.GL_TEXTURE_2D)
    gl.glPushMatrix
    gl.glBegin(GL.GL_QUADS)

    gl.glVertex2d(0,0)
    gl.glVertex2d(Options.width,0)
    gl.glVertex2d(Options.width,Options.height)
    gl.glVertex2d(0,Options.height)

    gl.glEnd
    gl.glPopMatrix
  }

}
